package com.xin.vip.pattern.delegate.simple;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class Leader implements IEmployee {

    private Map<String,IEmployee> targe=new ConcurrentHashMap<String,IEmployee>();

    public Leader() {
        targe.put("加密",new  EmployeeA());
        targe.put("登录",new  EmployeeB());
    }

    //工厂模式
    @Override
    public void doing(String command) {
//        if (command=="加密"){
//            new EmployeeA().doing(command);
//        }else if (command=="登录"){
//            new EmployeeB().doing(command);
//        }

        targe.get(command).doing(command);
    }
}
